package com.softaria.windows.model;

import com.softaria.windows.factories.ViewFactory;

/**
 * POJO class that represents view. Used as data. Created by {@link ViewFactory}
 * 
 * @author Roman M Kuzmin (roman@softaria.com)
 * 
 */
public class View extends Model {

  public static final int NEVER_MAXIMIZE = 1;

  private ViewUrl viewUrl;

  private SizeCalculator sizeCalculator = null;
  private PositionCalculator positionCalculator = null;

  private int flags;

  public ViewUrl getViewUrl() {
    return viewUrl;
  }

  public void setViewUrl(ViewUrl viewUrl) {
    this.viewUrl = viewUrl;
  }

  public SizeCalculator getSizeCalculator() {
    return sizeCalculator;
  }

  public void setSizeCalculator(SizeCalculator size) {
    this.sizeCalculator = size;
  }

  public PositionCalculator getPositionCalculator() {
    return positionCalculator;
  }

  public void setPositionCalculator(PositionCalculator positionCalculator) {
    this.positionCalculator = positionCalculator;
  }

  public int getFlags() {
    return flags;
  }

  public void setFlags(int flags) {
    this.flags = flags;
  }

  public void addFlag(int flag) {
    this.flags = flags | flag;
  }

  public boolean isFlagSet(int flag) {
    return (getFlags() & flag) != 0;
  }

  @Override
  public ModelUrl getUrl() {
    return viewUrl;
  }

}
